home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / misc / AWNP_2-39.lha / AWNP / AWNP-Docs / Demos / awebmodes.awebrx < prev    next >
Text File  |  1999-10-14  |  9KB  |  270 lines

  1. /*
  2.     $VER: AWeb Modes 1.2 (1.10.99) by Gabriele Favrin (favrin@tin.it)
  3.  
  4.     Change various AWeb modes from a ClassAct/Reaction GUI
  5.     Thanks to my Friend Bill Parker for his great AWNPipe!
  6. */
  7.  
  8. options results
  9. options failat 999
  10.  
  11. if ~Show('L', 'rexxsupport.library') then do
  12.     call addlib('rexxsupport.library', 0, -30, 0)
  13. end
  14.  
  15. if Show('P', 'AWEBMODES') then do
  16.     address AWEBMODES 'front'
  17.     exit
  18. end
  19.  
  20. if Exists('env:aweb3/') then
  21.     envname='aweb3/amwindow'
  22. else
  23.     envname='awebSE/amwindow'
  24.  
  25. eol='0A'x; spooftext.0=''; spooftext.1='Mozilla/3.01'
  26. 'Get VERSION VAR ver'
  27. fullv=(Pos('SE', ver) == 0)
  28. small2=''
  29. savewindow=''
  30. call initPipe()
  31. call getenv()
  32. call init()
  33. call manageGUI()
  34.  
  35. exit 0
  36.  
  37. init:
  38.     'Get SCREEN' VAR screen
  39.  
  40.     'GetCFG HTMLMODE VAR' html
  41.     'GetCFG FRAMES VAR' frames
  42.     'GetCFG NOMINALFRAME VAR' nframe
  43.     'GetCFG JAVASCRIPT VAR' js
  44.     'GetCFG JSERRORS VAR' jserrors
  45.     'GetCFG ANONYMOUS VAR' anon
  46.     'GetCFG IGNOREMIME VAR' mime
  47.     'GetCFG RFCCOOKIES VAR' rfc
  48.     'GetCFG NAVIGATION VAR' nav
  49.     'GetCFG SHOWBUTTONS VAR' buttons
  50.  
  51.     if fullv == 0 then do
  52.         jsbanners=0
  53.         spoof=0
  54.         gui_jsbanners='disable 1'
  55.         gui_spoof='disable 1'
  56.         spoofflag=0
  57.     end
  58.     else do
  59.         'GetCFG SUPPRESSBANNERS VAR' jsbanners
  60.         'GetCFG SPOOFAS VAR' spoof
  61.         gui_jsbanners='disable' 1-js
  62.         gui_spoof=''
  63.         spoofflag=(spoof ~= '')
  64.     end
  65.  
  66.     'PLUGIN awebgif.awebplugin ANIM'
  67.     if rc == 5 then do
  68.         anim=0
  69.         nogif=1
  70.     end
  71.     else do
  72.         anim=result
  73.         nogif=0
  74.     end
  75.     if small2 ~='' then small=small2
  76.     if savewindow ~='' then window=savewindow
  77.     gui='"AWeb Modes 1.2 - press <HELP> key for help" dg db 'window' cg ps "'screen'" so a q m sk'eol
  78.     if small == 1 then do
  79.         gui=gui||'menu gt "Project|Window|$@SSnapshot|$@UUnsnapshot|$@M^&Small|About|$!AWeb Modes 1.2|Author|$!Written by Gabriele Favrin|$!using AWNPIPE: gui|!|@QQuit"'eol
  80.         gui=gui||'layout so si b 0'eol'layout v so si gt "Document"'eol
  81.         gui=gui||'radiobutton rl "Strict |Tolerant |Compatible " s' html||eol'space minh 0'eol
  82.         gui=gui||'checkbox gt "_Frames" s' frames||eol'checkbox gt "_Nominal height" s' nframe 'disable' 1-frames||eol'checkbox gt "_GIF animation" s' anim 'disable' nogif||eol'space minh 0'eol
  83.         gui=gui||'checkbox gt "_JavaScript" s' js||eol'checkbox gt "JS _Errors" s' jserrors 'disable' 1-js||eol'checkbox gt "_Banner windows" s' jsbanners gui_jsbanners||eol'pg'eol
  84.         gui=gui||'layout b 0 v'eol'layout v so si gt "Network"'eol
  85.         gui=gui||'checkbox gt "_Anonymous" s' anon||eol'label gt "(HTTP referrer)" noms'eol'checkbox gt "S_poofing" s' spoofflag gui_spoof||eol'label gt "(as Netscape 3.x)"'eol
  86.         gui=gui||'checkbox gt "Ignore _MIME TYPE" s' mime||eol'checkbox gt "RFC 210_9 cookies" s' rfc||eol'pg'eol'space nimh 0'eol
  87.         gui=gui||'layout v so si gt "GUI"'eol'checkbox gt "Na_vigation" s' nav||eol'checkbox gt "_User buttons" s' buttons||eol'pg'eol'pg'eol'pg'eol
  88.     end
  89.     else do
  90.         gui=gui||'menu gt "Project|Window|$@SSnapshot|$@UUnsnapshot|$@M^%Small|About|$!AWeb Modes 1.2|Author|$!Written by Gabriele Favrin|$!using AWNPIPE: gui|!|@QQuit"'eol
  91.         gui=gui||'layout so si b 0'eol'layout v so si gt "Document related options"'eol
  92.         gui=gui||'radiobutton rl "Strict (HTML 2.0/3.2/4.0)|Tolerant (also 3.0/MSIE/NS HTML)|Compatible (badly written HTML)" s' html||eol'space minh 0'eol
  93.         gui=gui||'checkbox gt "Use _Frames" s' frames||eol'checkbox gt "_Nominal (fixed) frames height" s' nframe 'disable' 1-frames||eol'checkbox gt "_GIF animations playback" s' anim 'disable' nogif||eol'space minh 0'eol
  94.         gui=gui||'checkbox gt "_JavaScript usage" s' js||eol'checkbox gt "Show JavaScript _errors" s' jserrors 'disable' 1-js||eol'checkbox gt "Suppress JS _banner windows" s' jsbanners gui_jsbanners||eol'pg'eol
  95.         gui=gui||'layout b 0 v'eol'layout v so si gt "Network related options"'eol
  96.         gui=gui||'checkbox gt "_Anonymous browsing" s' anon||eol'label gt "(HTTP referrer header strip)" noms'eol'checkbox gt "S_poofing" s' spoofflag gui_spoof||eol'label gt "(HTTP/JS spoof as Netscape 3.x)"'eol
  97.         gui=gui||'checkbox gt "Ignore _MIME TYPE server header" s' mime||eol'checkbox gt "RFC 210_9 compliant cookies" s' rfc||eol'pg'eol'space nimh 0'eol
  98.         gui=gui||'layout v so si gt "GUI related options"'eol'checkbox gt "Show Na_vigation gadgets" s' nav||eol'checkbox gt "Show _User buttons" s' buttons||eol'pg'eol'pg'eol'pg'eol
  99.     end
  100.     gui=gui||'ARexx gt "AWEBMODES|front|quit|close"'eol'open'
  101.     return
  102.  
  103.  
  104. initPipe:
  105.     if Showlist('H', 'AWNPIPE') then res=open(gui_fp, 'awnpipe:awebmodes/-2010/xc', 'W')
  106.     if res ~= 1 then do
  107.         'request NOWAIT "Error" "To use this program you need AWNPipe:*N        (Vers 2.10 or newer)." "_OK"'
  108.         exit 0
  109.     end
  110.     return
  111.  
  112.  
  113. manageGUI:
  114.     call WriteLN(gui_fp, gui)
  115.     if small == 1 then call WriteLN(gui_fp,'id 1 tar 3 s 1')
  116.  
  117.     do while ~(EOF(gui_fp))
  118.         call WriteLN(gui_fp, 'continue')
  119.         gad=ReadLN(gui_fp)
  120.         select
  121.             when left(gad, 5) == 'arexx' then do
  122.                 parse VAR gad in1 in2 in3 .
  123.                 rxcmd=readch(gui_fp,in3)
  124.                 if in2>1 then call WriteLN(gui_fp,"rc 10")
  125.                 if in2 = 0 then do
  126.                     call WriteLN(gui_fp,'rc 0 result "AWebModes window brought to front"')
  127.                     tofront=1
  128.                 end
  129.                 if in2 = 1 then do
  130.                     call WriteLN(gui_fp,'rc 0 result "AWebModes exiting"')
  131.                     call WriteLN(gui_fp, 'close')
  132.                     call Close(gui_fp)
  133.                     exit 0
  134.                 end
  135.                 if tofront = 1 then do
  136.                     call WriteLN(gui_fp,'id 0 s 67')
  137.                     tofront=0
  138.                 end
  139.             end
  140.             when left(gad, 4) == 'menu' then do
  141.                 select
  142.                     when gad == 'menu 0 0 0 0' then call setenvarc()
  143.                     when gad == 'menu 0 0 1 0' then call unsetenvarc()
  144.                     when left(gad, 10) == 'menu 0 0 2' then do
  145.                         parse VAR gad . . . . small2 .
  146.                         call WriteLN(gui_fp,'id 0 read')
  147.                         windowr=ReadLN(gui_fp)
  148.                         parse VAR windowr wl wt ww wh .
  149.                         if (datatype(wt,N) &datatype(wl,N) ) then do
  150.                             savewindow='top' wt 'left' wl
  151.                         end
  152.                         call Close(gui_fp)
  153.                         call initPipe()
  154.                         call getenv()
  155.                         call init()
  156.                         call WriteLN(gui_fp, gui)
  157.                     end
  158.                     when gad == 'menu 0 4 31 0' then do
  159.                         call WriteLN(gui_fp, 'close')
  160.                         call Close(gui_fp)
  161.                         exit 0
  162.                     end
  163.                     otherwise nop
  164.                 end
  165.             end
  166.             when left(gad, 6) == 'gadget' then do
  167.                 parse VAR gad . gid value .
  168.                 select
  169.                     when gid == 4 then 'SetCFG HTMLMODE' value
  170.                     when gid == 5 then do
  171.                         call WriteLN(gui_fp, 'id 6 disable' 1-value 'ref 6')
  172.                         'SetCFG FRAMES' value
  173.                     end
  174.                     when gid == 6 then 'SetCFG NOMINALFRAME' value
  175.                     when gid == 7 then do
  176.                         if value == 1 then
  177.                             'PLUGIN awebgif.awebplugin STARTANIM'
  178.                         else
  179.                             'PLUGIN awebgif.awebplugin STOPANIM'
  180.                     end
  181.                     when gid == 8 then do
  182.                         call WriteLN(gui_fp, 'id 9 disable' 1-value 'ref 9')
  183.                         if fullv == 1 then call WriteLN(gui_fp, 'id 10 disable' 1-value 'ref 10')
  184.                         'SetCFG JAVASCRIPT' value
  185.                     end
  186.                     when gid == 9 then 'SetCFG JSERRORS' value
  187.                     when gid == 10 then 'SetCFG SUPPRESSBANNERS' value
  188.                     when gid == 13 then 'SetCFG ANONYMOUS' value
  189.                     when gid == 14 then 'SetCFG SPOOFAS "'spooftext.value'"'
  190.                     when gid == 15 then 'SetCFG IGNOREMIME' value
  191.                     when gid == 16 then 'SetCFG RFCCOOKIES' value
  192.                     when gid == 18 then do
  193.                         'SetCFG NAVIGATION' value
  194.                         call Delay(75)
  195.                         call WriteLN(gui_fp, 'id 0 s 3')
  196.                         if show('P','AWEBTOOLBAR') then address AWEBTOOLBAR 'front'
  197.                     end
  198.                     when gid == 19 then do
  199.                         'SetCFG SHOWBUTTONS' value
  200.                         call Delay(75)
  201.                         call WriteLN(gui_fp, 'id 0 s 3')
  202.                         if show('P','AWEBTOOLBAR') then address AWEBTOOLBAR 'front'
  203.                     end
  204.                 end
  205.             end
  206.             when left(gad, 3) == 'key' then do
  207.                 parse VAR gad . key .
  208.                 select
  209.                     when key == 161 then do
  210.                         call WriteLN(gui_fp, 'id 4 s 0 ref 4')
  211.                         'SetCFG HTMLMODE' 0
  212.                     end
  213.                     when key == 148 then do
  214.                         call WriteLN(gui_fp, 'id 4 s 1 ref 4')
  215.                         'SetCFG HTMLMODE' 1
  216.                     end
  217.                     when key == 179 then do
  218.                         call WriteLN(gui_fp, 'id 4 s 2 ref 4')
  219.                         'SetCFG HTMLMODE' 2
  220.                     end
  221.                     when key == 223 then 'OPEN "file:///AWebPath:Plugins/AWebModes_doc.html"'
  222.                     otherwise nop
  223.                 end
  224.             end
  225.             otherwise nop
  226.         end
  227.     end
  228.     call Close(gui_fp)
  229.     return
  230.  
  231.  
  232. getenv:
  233.     if Open(env, 'env:'envname, 'R') then do
  234.         windows=ReadLN(env)
  235.         small=ReadLN(env)
  236.         parse var windows wl wt ww wh .
  237.         window= 'top' wt 'left' wl
  238.         call Close(env)
  239.     end
  240.     else
  241.         window='cs'
  242.     return
  243.  
  244.  
  245. setenv:
  246.     call WriteLN(gui_fp,'id 0 read')
  247.     windowr=ReadLN(gui_fp)
  248.     parse VAR windowr wl wt .
  249.     if (datatype(wt,N) & datatype(wl,N) ) then do
  250.         if Open(env, 'env:'envname, 'W') then do
  251.             call WriteLN(env, windowr)
  252.             call WriteLN(env, small)
  253.             call Close(env)
  254.         end
  255.     end
  256.     return
  257.  
  258.  
  259. setenvarc:
  260.     call setenv()
  261.     address command 'C:Copy >NIL: QUIET "env:'envname'" "envarc:'envname'"'
  262.     return
  263.  
  264.  
  265. unsetenvarc:
  266.     call setenv()
  267.     if Exists('envarc:'envname) then delete('envarc:'envname)
  268.     if Exists('env:'envname) then delete('env:'envname)
  269.     return
  270.